FROM registry.cn-beijing.aliyuncs.com/hfhksoft/java:jre-slim-buster as builder
MAINTAINER lijiajia3515

WORKDIR build
RUN chmod +x ./buildw

FROM registry.cn-beijing.aliyuncs.com/hfhksoft/java:11-jre-slim-buster
MAINTAINER lijiajia3515

WORKDIR /cairo/system/service

COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder application/ ./
VOLUME /cairo/system/service/logs

ENV SPRING_PROFILES_ACTIVE container

ENV JVMOPS ''
ENV JAVAOPS ''
ENTRYPOINT ["sh", "-c","exec java $JVM_OPTS $JAVA_OPTS org.springframework.boot.loader.JarLauncher"]

EXPOSE 80/tcp 9000/tcp
HEALTHCHECK --start-period=10s \
            --interval=10s \
            --timeout=5s \
            --retries=5 \
            CMD curl --silent --fail --request GET http://localhost:9000/actuator/health | jq --exit-status '.status == "UP"' || exit 1
